package com.yq.ylmall.order.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yq.ylmall.client.product.ProductFeignClient;
import com.yq.ylmall.common.utils.AuthContextUtil;
import com.yq.ylmall.dto.order.OrderInfoDto;
import com.yq.ylmall.dto.order.OrderStatisticsDto;
import com.yq.ylmall.exception.ServiceException;
import com.yq.ylmall.model.acl.User;
import com.yq.ylmall.model.order.OrderInfo;
import com.yq.ylmall.model.order.OrderItem;
import com.yq.ylmall.order.service.IOrderInfoService;
import com.yq.ylmall.order.service.IOrderItemService;
import com.yq.ylmall.result.Result;
import com.yq.ylmall.result.ResultCode;
import com.yq.ylmall.vo.order.OrderStatisticsVo;
import com.yq.ylmall.vo.product.ProductInfoVo;
import io.seata.spring.annotation.GlobalTransactional;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 订单 前端控制器
 * </p>
 *
 * @author cherry
 * @since 2024-06-05
 */
@RestController
@RequestMapping("/admin/order/orderInfo")
public class OrderInfoController {

    @Autowired
    private IOrderInfoService orderInfoService ;


    @GetMapping("/getOrderStatisticsData")
    public Result<OrderStatisticsVo> getOrderStatisticsData(OrderStatisticsDto orderStatisticsDto) {
        OrderStatisticsVo orderStatisticsVo = orderInfoService.getOrderStatisticsData(orderStatisticsDto) ;
        return Result.build(orderStatisticsVo , ResultCode.SUCCESS) ;
    }

    @PostMapping("/createOrder")
    public Result createOrder(@RequestBody OrderInfoDto orderInfoDto) {
        return orderInfoService.createOrder(orderInfoDto);
    }

}
